package com.app.dao;

import javax.annotation.Resource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import com.app.model.RoleUser;

@Repository
public class RoleUserDao {
	@Resource
	private JdbcTemplate jdbcTemplate;
	
	public void save(RoleUser roleUser) {
		String sql = "insert into auth_role_user(roleId,roleName,userId) values(?,?,?)";
		Object args[] = {roleUser.getRoleId(),roleUser.getRoleName(),roleUser.getUserId()};
		jdbcTemplate.update(sql, args);
		
	}

	public void delete(Long userId,Long roleId) {
		String sql = "delete from auth_role_user where userId=? and roleId=?";
		Object args[] = {userId,roleId};
		jdbcTemplate.update(sql, args);
		
	}
 
}
